package org.example.im.bean.protocol;

import lombok.Data;

/**
 * @author dingrui
 * @since 2022/2/10
 * @description
 */

/**
 * <p> the packet </p>
 *
 * <pre>
 * +----------------+ +----------------+ +----------------+ +----------------+ +----------------+ +----------------+
 * |      4         | |       1        | |       1        | |       1        | |       4        | |       n        |
 * |  MAGIC_NUMBER  | |    VERSION     | | SERIALIZER_IMPL| |  COMMAND_TYPE  | | BODY_LENGTH(n) | |     BODY       |
 * +----------------+ +----------------+ +----------------+ +----------------+ +----------------+ +----------------+
 * </pre>
 */
@Data
public abstract class Packet {

    public static final int LENGTH_FIELD_OFFSET = 7;
    public static final int LENGTH_FIELD_LEN = 4;

    private Byte version = 1;

    public abstract CommandType getCommandType();
}
